<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/astronaut32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/astronaut16.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">

<link rel="stylesheet" href="fonts.googleapis.com/css?family=EB Garamond:300,300italic,400,400italic,700,700italic|Cinzel Decorative:300,300italic,400,400italic,700,700italic|Noto Serif SC:300,300italic,400,400italic,700,700italic|Source Code Pro:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-pace-theme-minimal.min.css">
  <script src="/lib/pace/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"fat_fat_where_are_you.gitee.io","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"mac"},"back2top":{"enable":false,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500&display=swap" rel="stylesheet">
  <meta name="description" content="C语言（谭浩强版）读书笔记">
<meta property="og:type" content="article">
<meta property="og:title" content="C 语言学习笔记 ( 上）">
<meta property="og:url" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc.html">
<meta property="og:site_name" content="肥肉啊肥肉你在哪">
<meta property="og:description" content="C语言（谭浩强版）读书笔记">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220231150.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220318654-1632636665832.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220406796-1632636669783.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220438384-1632636673093.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220516844.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220512281.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220712999-1632636680082.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220743997-1632636682288.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220909305-1632636685002.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220850849-1632636687028.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220937753-1632636690821.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225221338665-1632636695884.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225221344308-1632636697706.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225221650180-1632636699683.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225221705491-1632636701501.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225221731885-1632636703505.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225221823915-1632636706296.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225221832971-1632636708866.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225221836438-1632636710704.png">
<meta property="og:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225221859710-1632636712388.png">
<meta property="article:published_time" content="2021-08-17T07:05:43.000Z">
<meta property="article:modified_time" content="2021-08-17T07:05:43.000Z">
<meta property="article:author" content="肥肉啊肥肉你在哪">
<meta property="article:tag" content="C语言">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc/20181225220231150.png">

<link rel="canonical" href="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc.html">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>
<link rel="stylesheet" type="text/css" href="/css/injector/main.css"><link rel="preload" as="style" href="/css/injector/light.css"><link rel="preload" as="style" href="/css/injector/dark.css">
  <title>C 语言学习笔记 ( 上） | 肥肉啊肥肉你在哪</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

  <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css">

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">肥肉啊肥肉你在哪</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
        <li class="menu-item menu-item-movies">

    <a href="/movies/" rel="section"><i class="fa fa-film fa-fw"></i>观影</a>

  </li>
        <li class="menu-item menu-item-books">

    <a href="/books/" rel="section"><i class="fa fa-book fa-fw"></i>阅读</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" placeholder="搜索..." spellcheck="false" type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="reading-progress-bar"></div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/touxiang.gif">
      <meta itemprop="name" content="肥肉啊肥肉你在哪">
      <meta itemprop="description" content>
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="肥肉啊肥肉你在哪">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          C 语言学习笔记 ( 上）
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-08-17 15:05:43" itemprop="dateCreated datePublished" datetime="2021-08-17T15:05:43+08:00">2021-08-17</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E8%80%83%E7%A0%94/" itemprop="url" rel="index"><span itemprop="name">考研</span></a>
                </span>
            </span>

          
          
          <br>
            <span id="/archives/fb4ff9cc.html" class="post-meta-item leancloud_visitors" data-flag-title="C 语言学习笔记 ( 上）" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="leancloud-visitors-count"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/archives/fb4ff9cc.html#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/archives/fb4ff9cc.html" itemprop="commentCount"></span>
    </a>
  </span>
  
  <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>1.6k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="C 语言（谭浩强版）读书笔记"><a href="#C 语言（谭浩强版）读书笔记" class="headerlink" title="C 语言（谭浩强版）读书笔记"></a>C 语言（谭浩强版）读书笔记</h1><span id="more"></span>

<h2 id="1- 加油"><a href="#1- 加油" class="headerlink" title="1. 加油"></a>1. 加油</h2><h2 id="2- 程序组成"><a href="#2- 程序组成" class="headerlink" title="2. 程序组成"></a>2. 程序组成</h2><p><img data-src="/archives/fb4ff9cc/20181225220231150.png"></p>
<h2 id="3- 数据类型"><a href="#3- 数据类型" class="headerlink" title="3. 数据类型"></a>3. 数据类型</h2><h3 id="3-1 数据类型"><a href="#3-1 数据类型" class="headerlink" title="3.1 数据类型"></a>3.1 数据类型</h3><p><img data-src="/archives/fb4ff9cc/20181225220318654-1632636665832.png"></p>
<blockquote>
<p>实数常量指数形式，规定以字母 e 或 E 代表以 10 为底的指数。但应注意：e 或 E 之前必须有数字，且 e 或 E 后面必须为 <code> 整数</code>。如不能写成 e4，12e2.5。</p>
</blockquote>
<h3 id="3-2 常量类型"><a href="#3-2 常量类型" class="headerlink" title="3.2 常量类型"></a>3.2 常量类型</h3><p><img data-src="/archives/fb4ff9cc/20181225220406796-1632636669783.png"></p>
<blockquote>
<p>注意：C 程序中的实型常量都是双精度浮点型常量。<br>如果有：<br>float a=3.14159；<br>    在进行编译时，对 float 变量分配 4 个字节，但对于浮点型常量 3.14159，则按双精度处理，分配 8 个字节。编译系统会发出“警告”(warning:truncation from’const double’tofloat’)。意为“把一个双精度常量转换为 float 型”，提醒用户注意这种转换可能损失精度。<br> 可以在常量的末尾加专用字符，强制指定常量的类型。如在 3.14159 后面加字母 F 或 f，就表示是 float 型常量，分配 4 个字节。如果在实型常量后面加大写或小写的 L，指定此常量为 long double 类型。如：<br> float a=3.14159f；// 把此 3.14159 按单精度浮点常量处理，编译时不出现“警告”。<br> long doublea==1.231// 把此 1.23 作为 long double 处理</p>
</blockquote>
<h3 id="3-3 转义字符"><a href="#3-3 转义字符" class="headerlink" title="3.3 转义字符"></a>3.3 转义字符</h3><p><img data-src="/archives/fb4ff9cc/20181225220438384-1632636673093.png"></p>
<h3 id="3-4 格式字符 - 修饰符"><a href="#3-4 格式字符 - 修饰符" class="headerlink" title="3.4 格式字符 / 修饰符"></a>3.4 格式字符 / 修饰符</h3><blockquote>
<p>见 6.3（1）。</p>
</blockquote>
<h2 id="4- 运算"><a href="#4- 运算" class="headerlink" title="4. 运算"></a>4. 运算</h2><h3 id="4-1 优先级"><a href="#4-1 优先级" class="headerlink" title="4.1 优先级"></a>4.1 优先级</h3><p>（1）i++ 与 ++i 不同；<br>（2）附录 D；</p>
<h3 id="4-2 不同类型混合运算"><a href="#4-2 不同类型混合运算" class="headerlink" title="4.2 不同类型混合运算"></a>4.2 不同类型混合运算</h3><p>float/double&gt;int&gt;char<br>（1）双目运算有一个为 float/double，则结果为 double，必有小数点；<br>（2）char 数据与 int 整型运算，结果为整型；<br>（3）a=5;     a/2：a 为整型则结果为 2；a 为 double 则结果为 2.5；<br><img data-src="/archives/fb4ff9cc/20181225220516844.png"></p>
<p><img data-src="/archives/fb4ff9cc/20181225220512281.png"></p>
<h3 id="4-3 强制转换类型"><a href="#4-3 强制转换类型" class="headerlink" title="4.3 强制转换类型"></a>4.3 强制转换类型</h3><p>（类型名）（表达式）</p>
<blockquote>
<p>% 要求两侧均为整型，floatx;  x%3;    // 不合法，改为 int(x)%3</p>
</blockquote>
<h2 id="5- 头文件"><a href="#5- 头文件" class="headerlink" title="5. 头文件"></a>5. 头文件</h2><h3 id="5-1stdio-h"><a href="#5-1stdio-h" class="headerlink" title="5.1stdio.h"></a>5.1stdio.h</h3><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">standardinput\&amp;output.header 标准输入和输出. 头文件</span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span>\<span class="meta-string">&lt;stdio.h&gt;</span><span class="comment">// 标准方式</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span>”stadio.h”<span class="comment">// 先当前目录再标准方式</span></span></span><br></pre></td></tr></table></figure>

<h3 id="5-2math-h"><a href="#5-2math-h" class="headerlink" title="5.2math.h"></a>5.2math.h</h3><h3 id="5-3stdlib-h"><a href="#5-3stdlib-h" class="headerlink" title="5.3stdlib.h"></a>5.3stdlib.h</h3><h3 id="5-4string-h"><a href="#5-4string-h" class="headerlink" title="5.4string.h"></a>5.4string.h</h3><h2 id="6-C 语句"><a href="#6-C 语句" class="headerlink" title="6.C 语句"></a>6.C 语句</h2><h3 id="6-1 表达式 - 语句"><a href="#6-1 表达式 - 语句" class="headerlink" title="6.1 表达式 / 语句"></a>6.1 表达式 / 语句</h3><p><img data-src="/archives/fb4ff9cc/20181225220712999-1632636680082.png"></p>
<h3 id="6-2 赋值语句"><a href="#6-2 赋值语句" class="headerlink" title="6.2 赋值语句"></a>6.2 赋值语句</h3><p><img data-src="/archives/fb4ff9cc/20181225220743997-1632636682288.png"></p>
<h3 id="6-3 输入输出"><a href="#6-3 输入输出" class="headerlink" title="6.3 输入输出"></a>6.3 输入输出</h3><h4 id="（1）数据输出"><a href="#（1）数据输出" class="headerlink" title="（1）数据输出"></a>（1）数据输出</h4><p><img data-src="/archives/fb4ff9cc/20181225220909305-1632636685002.png"><br><img data-src="/archives/fb4ff9cc/20181225220850849-1632636687028.png"></p>
<h4 id="（2）数据输入"><a href="#（2）数据输入" class="headerlink" title="（2）数据输入"></a>（2）数据输入</h4><p><img data-src="/archives/fb4ff9cc/20181225220937753-1632636690821.png"></p>
<h4 id="（3）字符输出"><a href="#（3）字符输出" class="headerlink" title="（3）字符输出"></a>（3）字符输出</h4><table>
<thead>
<tr>
<th>putchar</th>
<th>()</th>
</tr>
</thead>
<tbody><tr>
<td>说明</td>
<td>①putcharacter   ②将 ASCII 码赋值给字符变量，范围 0-127</td>
</tr>
</tbody></table>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">eg:chara=’B’,b=<span class="number">79</span><span class="comment">// 定义 </span></span><br><span class="line"><span class="built_in">putchar</span>(a);<span class="comment">// 常规操作</span></span><br><span class="line"><span class="built_in">putchar</span>(b);<span class="comment">//ASCII 码 79 对应字符</span></span><br><span class="line"><span class="built_in">putchar</span>(‘<span class="number">131</span>’)<span class="comment">//ASCII 码 131 对应字符</span></span><br><span class="line"><span class="built_in">putchar</span>(‘\n’)<span class="comment">// 转义字符换行</span></span><br><span class="line"> 输出：BOY</span><br></pre></td></tr></table></figure>

<h4 id="（4）字符输入"><a href="#（4）字符输入" class="headerlink" title="（4）字符输入"></a>（4）字符输入</h4><table>
<thead>
<tr>
<th>getchar</th>
<th>（）</th>
</tr>
</thead>
<tbody><tr>
<td>说明</td>
<td>①getcharacter    ②全部输完后按 Enter 结束    ③putchar(getchar());  ④printf(“c%”,getchar());</td>
</tr>
</tbody></table>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string">&lt;stdio.h&gt;</span></span></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line"><span class="keyword">char</span> a,b;</span><br><span class="line">a=getchar(); <span class="comment">// 输入转换为字符常量</span></span><br><span class="line">b=a<span class="number">-32</span>; <span class="comment">// 小写字母转大写字母</span></span><br><span class="line"><span class="built_in">putchar</span>(b); <span class="comment">// 常规输出 1</span></span><br><span class="line"><span class="built_in">putchar</span>(’\n’); <span class="comment">// 换行</span></span><br><span class="line"><span class="built_in">printf</span>(<span class="string">&quot;%c&quot;</span>,b); <span class="comment">// 常规输出 2</span></span><br><span class="line"><span class="built_in">putchar</span>(’\n’); <span class="comment">// 换行</span></span><br><span class="line"><span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



<p>输入:a，输出:A、A<br><img data-src="/archives/fb4ff9cc/20181225221338665-1632636695884.png"><br><img data-src="/archives/fb4ff9cc/20181225221344308-1632636697706.png"></p>
<h3 id="6-4 选择结构"><a href="#6-4 选择结构" class="headerlink" title="6.4 选择结构"></a>6.4 选择结构 </h3><h4 id="（1）if-else"><a href="#（1）if-else" class="headerlink" title="（1）if/else"></a>（1）if/else</h4><p> 双分支<br><img data-src="/archives/fb4ff9cc/20181225221650180-1632636699683.png"></p>
<h4 id="（2）-："><a href="#（2）-：" class="headerlink" title="（2）?/："></a>（2）?/：</h4><p><img data-src="/archives/fb4ff9cc/20181225221705491-1632636701501.png"></p>
<h4 id="（3）switch-case"><a href="#（3）switch-case" class="headerlink" title="（3）switch/case"></a>（3）switch/case</h4><p>多分支<br><img data-src="/archives/fb4ff9cc/20181225221731885-1632636703505.png"></p>
<blockquote>
<p>①表达式与常量比较，若相同则一直执行下去，直到遇到 break 跳出此循环<br>②多 case 共用一组语句：<br>case‘A’:  </p>
<p>case(B):printf(“&gt;60\n”);break;</p>
</blockquote>
<h3 id="6-5 循环结构"><a href="#6-5 循环结构" class="headerlink" title="6.5 循环结构"></a>6.5 循环结构</h3><h4 id="（1）while-do-while-for"><a href="#（1）while-do-while-for" class="headerlink" title="（1）while/do,while/for"></a>（1）while/do,while/for</h4><p><img data-src="/archives/fb4ff9cc/20181225221823915-1632636706296.png"><br><img data-src="/archives/fb4ff9cc/20181225221832971-1632636708866.png"><br><img data-src="/archives/fb4ff9cc/20181225221836438-1632636710704.png"></p>
<h4 id="（2）break-continue"><a href="#（2）break-continue" class="headerlink" title="（2）break/continue"></a>（2）break/continue</h4><p>改变循环状态<br><img data-src="/archives/fb4ff9cc/20181225221859710-1632636712388.png"></p>

    </div>

    
    
    
      

        <div class="reward-container">
  <div>感谢各位打赏的小伙伴</div>
  <button onclick="var qr = document.getElementById('qr'); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">
      
      <div style="display: inline-block;">
        <img src="/images/wechatpay.png" alt="肥肉啊肥肉你在哪 微信支付">
        <p>微信支付</p>
      </div>
      
      <div style="display: inline-block;">
        <img src="/images/alipay.png" alt="肥肉啊肥肉你在哪 支付宝">
        <p>支付宝</p>
      </div>

  </div>
</div>

        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>肥肉啊肥肉你在哪
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc.html" title="C 语言学习笔记 ( 上）">http://fat_fat_where_are_you.gitee.io/archives/fb4ff9cc.html</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noopener noreferrer" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/C%E8%AF%AD%E8%A8%80/" rel="tag"><i class="fas fa-tags"></i> C语言</a>
          </div>

        
  <div class="post-widgets">
    <div class="wp_rating">
      <div id="wpac-rating"></div>
    </div>
  </div>


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/archives/5e0e6698.html" rel="prev" title="菲茨定律">
      <i class="fa fa-chevron-left"></i> 菲茨定律
    </a></div>
      <div class="post-nav-item">
    <a href="/archives/9ced5463.html" rel="next" title="考研数据结构代码整理">
      考研数据结构代码整理 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#C%20%E8%AF%AD%E8%A8%80%EF%BC%88%E8%B0%AD%E6%B5%A9%E5%BC%BA%E7%89%88%EF%BC%89%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0"><span class="nav-text">C 语言（谭浩强版）读书笔记</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%20%E5%8A%A0%E6%B2%B9"><span class="nav-text">1. 加油</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%20%E7%A8%8B%E5%BA%8F%E7%BB%84%E6%88%90"><span class="nav-text">2. 程序组成</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%20%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="nav-text">3. 数据类型</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1%20%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B"><span class="nav-text">3.1 数据类型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2%20%E5%B8%B8%E9%87%8F%E7%B1%BB%E5%9E%8B"><span class="nav-text">3.2 常量类型</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3%20%E8%BD%AC%E4%B9%89%E5%AD%97%E7%AC%A6"><span class="nav-text">3.3 转义字符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4%20%E6%A0%BC%E5%BC%8F%E5%AD%97%E7%AC%A6%20-%20%E4%BF%AE%E9%A5%B0%E7%AC%A6"><span class="nav-text">3.4 格式字符 &#x2F; 修饰符</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%20%E8%BF%90%E7%AE%97"><span class="nav-text">4. 运算</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#4-1%20%E4%BC%98%E5%85%88%E7%BA%A7"><span class="nav-text">4.1 优先级</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-2%20%E4%B8%8D%E5%90%8C%E7%B1%BB%E5%9E%8B%E6%B7%B7%E5%90%88%E8%BF%90%E7%AE%97"><span class="nav-text">4.2 不同类型混合运算</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-3%20%E5%BC%BA%E5%88%B6%E8%BD%AC%E6%8D%A2%E7%B1%BB%E5%9E%8B"><span class="nav-text">4.3 强制转换类型</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-%20%E5%A4%B4%E6%96%87%E4%BB%B6"><span class="nav-text">5. 头文件</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#5-1stdio-h"><span class="nav-text">5.1stdio.h</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-2math-h"><span class="nav-text">5.2math.h</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-3stdlib-h"><span class="nav-text">5.3stdlib.h</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-4string-h"><span class="nav-text">5.4string.h</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-C%20%E8%AF%AD%E5%8F%A5"><span class="nav-text">6.C 语句</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#6-1%20%E8%A1%A8%E8%BE%BE%E5%BC%8F%20-%20%E8%AF%AD%E5%8F%A5"><span class="nav-text">6.1 表达式 &#x2F; 语句</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-2%20%E8%B5%8B%E5%80%BC%E8%AF%AD%E5%8F%A5"><span class="nav-text">6.2 赋值语句</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-3%20%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA"><span class="nav-text">6.3 输入输出</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%EF%BC%881%EF%BC%89%E6%95%B0%E6%8D%AE%E8%BE%93%E5%87%BA"><span class="nav-text">（1）数据输出</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%EF%BC%882%EF%BC%89%E6%95%B0%E6%8D%AE%E8%BE%93%E5%85%A5"><span class="nav-text">（2）数据输入</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%EF%BC%883%EF%BC%89%E5%AD%97%E7%AC%A6%E8%BE%93%E5%87%BA"><span class="nav-text">（3）字符输出</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%EF%BC%884%EF%BC%89%E5%AD%97%E7%AC%A6%E8%BE%93%E5%85%A5"><span class="nav-text">（4）字符输入</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-4%20%E9%80%89%E6%8B%A9%E7%BB%93%E6%9E%84"><span class="nav-text">6.4 选择结构 </span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%EF%BC%881%EF%BC%89if-else"><span class="nav-text">（1）if&#x2F;else</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%EF%BC%882%EF%BC%89-%EF%BC%9A"><span class="nav-text">（2）?&#x2F;：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%EF%BC%883%EF%BC%89switch-case"><span class="nav-text">（3）switch&#x2F;case</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-5%20%E5%BE%AA%E7%8E%AF%E7%BB%93%E6%9E%84"><span class="nav-text">6.5 循环结构</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%EF%BC%881%EF%BC%89while-do-while-for"><span class="nav-text">（1）while&#x2F;do,while&#x2F;for</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%EF%BC%882%EF%BC%89break-continue"><span class="nav-text">（2）break&#x2F;continue</span></a></li></ol></li></ol></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="肥肉啊肥肉你在哪" src="/images/touxiang.gif">
  <p class="site-author-name" itemprop="name">肥肉啊肥肉你在哪</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">38</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">4</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">16</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/feirouafeirou" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;feirouafeirou" rel="external nofollow noopener noreferrer" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="http://wpa.qq.com/msgrd?v=3&uin=1729013657&site=qq&menu=yes" title="QQ → http:&#x2F;&#x2F;wpa.qq.com&#x2F;msgrd?v&#x3D;3&amp;uin&#x3D;1729013657&amp;site&#x3D;qq&amp;menu&#x3D;yes" rel="external nofollow noopener noreferrer" target="_blank"><i class="fab fa-qq fa-fw"></i>QQ</a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://www.woshipm.com/" title="http:&#x2F;&#x2F;www.woshipm.com" rel="external nofollow noopener noreferrer" target="_blank">人人都是产品经理</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://www.chanpin100.com/" title="http:&#x2F;&#x2F;www.chanpin100.com" rel="external nofollow noopener noreferrer" target="_blank">产品壹佰</a>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>

  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 2020 – 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">肥肉啊肥肉你在哪</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">237k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">3:35</span>
</div>

<div class="translate-style">
繁/简：<a id="translateLink" href="javascript:translatePage();">繁体
</a>
</div>
<script type="text/javascript" src="/js/tw_cn.js"></script>
<script type="text/javascript">
var defaultEncoding = 2; //网站编写字体是否繁体，1-繁体，2-简体
var translateDelay = 0; //延迟时间,若不在前, 要设定延迟翻译时间, 如100表示100ms,默认为0
var cookieDomain = "https://feirouafeirou.github.io/"; //Cookie地址, 一定要设定, 通常为你的网址
var msgToTraditionalChinese = "繁体"; //此处可以更改为你想要显示的文字
var msgToSimplifiedChinese = "简体"; //同上，但两处均不建议更改
var translateButtonId = "translateLink"; //默认互换id
translateInitilization();
</script>


        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>


  <script defer src="/lib/three/three.min.js"></script>


  



  <script>
  if (CONFIG.page.isPost) {
    wpac_init = window.wpac_init || [];
    wpac_init.push({
      widget: 'Rating',
      id    : 26171,
      el    : 'wpac-rating',
      color : 'fc6423'
    });
    (function() {
      if ('WIDGETPACK_LOADED' in window) return;
      WIDGETPACK_LOADED = true;
      var mc = document.createElement('script');
      mc.type = 'text/javascript';
      mc.async = true;
      mc.src = '//embed.widgetpack.com/widget.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(mc, s.nextSibling);
    })();
  }
  </script>

  
<script src="/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'puzQn5yHhkbtBj2VGFbqJ4FE-MdYXbMMI',
      appKey     : 'lmcgKM2surcxNxMRiqInHjkU',
      placeholder: "Just go go",
      avatar     : 'retro',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : true,
      lang       : '' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>
<div class="moon-menu">
  <div class="moon-menu-items">
    
    <div id="moon-menu-item-back2bottom" class="moon-menu-item" onclick="back2bottom()">
      <i class="fa fa-chevron-down"></i>    </div>
    
    <div id="moon-menu-item-back2top" class="moon-menu-item" onclick="back2top()">
      <i class="fa fa-chevron-up"></i>    </div>
    
  </div>
  <div class="moon-menu-button">
    <svg class="moon-menu-bg">
      <circle class="moon-menu-cricle" cx="50%" cy="50%" r="44%"/>
      <circle class="moon-menu-border" cx="50%" cy="50%" r="48%"/>
    </svg>
    <div class="moon-menu-content">
      <div class="moon-menu-icon"><i class="fas fa-ellipsis-v"></i></div>
      <div class="moon-menu-text"></div>
    </div>
  </div>
</div><script src="/js/injector.js"></script>
<!-- 数字雨 -->
<!-- <canvas id="canvas" width="1440" height="900" ></canvas> -->
<!-- <script type="text/javascript" src="/js/src/DigitalRain.js"></script> -->
<!-- 页面点击小红心 -->
<script type="text/javascript" src="/js/src/clicklove.js"></script>
<!--浏览器搞笑标题-->
<script type="text/javascript" src="/js/FunnyTitle.js"></script>
<!-- Live2D看板娘 -->
<!-- <script src="/live2d-widget/autoload.js"></script> -->
<!-- <script src="https://feirouafeirou.github.io/live2d-widget/autoload.js"></script> -->
<!-- 网页音乐播放器 -->
<!-- <link rel="stylesheet" href="/dist/APlayer.min.css">
<div id="aplayer"></div>
<script type="text/javascript" src="/dist/APlayer.min.js"></script>
<script type="text/javascript" src="/dist/music.js"></script> -->
</body>

</html>
